// @ts-strict-ignore
import {
  AppAvatarFragment,
  ChannelUsabilityDataQuery,
  CountryWithCodeFragment,
  FulfillmentStatus,
  InvoiceFragment,
  JobStatusEnum,
  MarkAsPaidStrategyEnum,
  OrderAction,
  OrderDetailsFragment,
  OrderDetailsQuery,
  OrderDetailsWithMetadataFragment,
  OrderEventsEmailsEnum,
  OrderEventsEnum,
  OrderFulfillLineFragment,
  OrderGrantedRefundFragment,
  OrderListQuery,
  OrderPaymentFragment,
  OrderSettingsFragment,
  OrderStatus,
  PaymentChargeStatusEnum,
  PaymentGatewayFragment,
  SearchCustomersQuery,
  SearchOrderVariantQuery,
  SearchWarehousesQuery,
  ShopOrderSettingsFragment,
  TransactionActionEnum,
  TransactionEventFragment,
  TransactionEventTypeEnum,
  TransactionItemFragment,
  TransactionKind,
  WeightUnitsEnum,
} from "@dashboard/graphql";
import { staffMember } from "@dashboard/staff/fixtures";
import { RelayToFlat } from "@dashboard/types";
import {
  warehouseForPickup,
  warehouseList,
} from "@dashboard/warehouses/fixtures";
import { MessageDescriptor } from "react-intl";

import { transformOrderStatus, transformPaymentStatus } from "../misc";

export const MOCK_PAYMENT_GATEWAY_ID = "saleor.dummy.payment";

export const prepareMoney = (
  amount?: number,
): OrderDetailsQuery["order"]["totalAuthorized"] => ({
  __typename: "Money",
  amount: amount ?? ORDER_AMOUNT,
  currency: "USD",
});

export const countries: CountryWithCodeFragment[] = [
  { __typename: "CountryDisplay", code: "AF", country: "Afghanistan" },
  { __typename: "CountryDisplay", code: "AX", country: "Åland Islands" },
  { __typename: "CountryDisplay", code: "AL", country: "Albania" },
  { __typename: "CountryDisplay", code: "DZ", country: "Algeria" },
  { __typename: "CountryDisplay", code: "AS", country: "American Samoa" },
];

const paymentGateways: PaymentGatewayFragment[] = [
  { __typename: "PaymentGateway", id: "app.saleor.adyen", name: "Adyen" },
  {
    id: MOCK_PAYMENT_GATEWAY_ID,
    name: "Mock Payment Gateway",
    __typename: "PaymentGateway",
  },
];

export const shop: OrderDetailsQuery["shop"] = {
  __typename: "Shop",
  countries,
  defaultWeightUnit: WeightUnitsEnum.KG,
  fulfillmentAllowUnpaid: true,
  fulfillmentAutoApprove: true,
  availablePaymentGateways: paymentGateways,
};

export const clients: RelayToFlat<SearchCustomersQuery["search"]> = [
  {
    __typename: "User" as "User",
    email: "test.client1@example.com",
    firstName: "John",
    id: "c1",
    lastName: "Doe",
  },
  {
    __typename: "User" as "User",
    email: "test.client2@example.com",
    firstName: "Dough",
    id: "c2",
    lastName: "Jones",
  },
  {
    __typename: "User" as "User",
    email: "test.client3@example.com",
    firstName: "Jonas",
    id: "c3",
    lastName: "Dough",
  },
  {
    __typename: "User" as "User",
    email: "test.client4@example.com",
    firstName: "Bill",
    id: "c4",
    lastName: "Jonas",
  },
];

export const orderTransactions: TransactionItemFragment[] = [
  {
    id: "VHJhbnNhY3Rpb25JdGVtOjE=",
    name: "mollie-creditcard",
    pspReference: "ord_3d41ih",
    actions: [],
    externalUrl: null,
    events: [
      {
        id: "VHJhbnNhY3Rpb25FdmVudDox",
        pspReference: "XCFDSDXCDF232332DFGS",
        createdAt: "2022-08-12T14:22:22.226875+00:00",
        type: TransactionEventTypeEnum.CHARGE_SUCCESS,
        createdBy: null,
        externalUrl: null,
        message: null,
        amount: {
          amount: 58.98,
          currency: "USD",
          __typename: "Money",
        },
        __typename: "TransactionEvent",
      },
    ],
    authorizedAmount: prepareMoney(0),
    authorizePendingAmount: prepareMoney(0),
    chargedAmount: prepareMoney(58.98),
    chargePendingAmount: prepareMoney(0),
    refundedAmount: prepareMoney(0),
    refundPendingAmount: prepareMoney(0),
    canceledAmount: prepareMoney(0),
    cancelPendingAmount: prepareMoney(0),
    __typename: "TransactionItem",
  },
  {
    id: "VHJhbnNhY3Rpb25JdGVtOjI=",
    name: "test",
    pspReference: "123",
    externalUrl: null,
    actions: [],
    events: [
      {
        id: "VHJhbnNhY3Rpb25FdmVudDoy",
        pspReference: "SDFDS34543SDDFS",
        createdAt: "2022-08-12T14:14:27.119138+00:00",
        type: TransactionEventTypeEnum.CHARGE_SUCCESS,
        createdBy: null,
        externalUrl: null,
        message: null,
        amount: {
          amount: 35.42,
          currency: "USD",
          __typename: "Money",
        },
        __typename: "TransactionEvent",
      },
      {
        id: "VHJhbnNhY3Rpb25FdmVudDoy",
        pspReference: "SDFDS34543SS",
        createdAt: "2022-08-12T16:14:27.119138+00:00",
        type: TransactionEventTypeEnum.REFUND_REQUEST,
        createdBy: null,
        externalUrl: null,
        message: null,
        amount: {
          amount: 33.21,
          currency: "USD",
          __typename: "Money",
        },
        __typename: "TransactionEvent",
      },
      {
        id: "VHJhbnNhY3Rpb25FdmVudDoy",
        pspReference: "SDFDS34543SS",
        createdAt: "2022-08-12T16:14:29.119138+00:00",
        type: TransactionEventTypeEnum.REFUND_SUCCESS,
        createdBy: null,
        externalUrl: null,
        message: null,
        amount: {
          amount: 33.21,
          currency: "USD",
          __typename: "Money",
        },
        __typename: "TransactionEvent",
      },
    ],
    authorizedAmount: prepareMoney(1.21),
    authorizePendingAmount: prepareMoney(0),
    chargedAmount: prepareMoney(0),
    chargePendingAmount: prepareMoney(0),
    refundedAmount: prepareMoney(34.21),
    refundPendingAmount: prepareMoney(0),
    canceledAmount: prepareMoney(0),
    cancelPendingAmount: prepareMoney(0),
    __typename: "TransactionItem",
  },
];

export const orders: RelayToFlat<OrderListQuery["orders"]> = [
  {
    __typename: "Order",
    billingAddress: {
      __typename: "Address",
      city: "East Aaronville",
      cityArea: "",
      companyName: "",
      country: {
        __typename: "CountryDisplay",
        code: "BE",
        country: "Belgia",
      },
      countryArea: "",
      firstName: "Laura",
      id: "QWRkcmVzczo5",
      lastName: "Stone 1 2",
      phone: "",
      postalCode: "88741",
      streetAddress1: "3678 John Course",
      streetAddress2: "",
    },
    created: "2018-09-11T09:37:30.376876+00:00",
    id: "T3JkZXI6MjA=",
    number: "20",
    paymentStatus: PaymentChargeStatusEnum.FULLY_CHARGED,
    status: OrderStatus.CANCELED,
    total: {
      __typename: "TaxedMoney",
      gross: {
        __typename: "Money",
        amount: 305.17,
        currency: "USD",
      },
    },
    userEmail: "laura.stone@example.com",
  },
  {
    __typename: "Order",
    billingAddress: {
      __typename: "Address",
      city: "Port Danielshire",
      cityArea: "",
      companyName: "",
      country: {
        __typename: "CountryDisplay",
        code: "SE",
        country: "Szwecja",
      },
      countryArea: "",
      firstName: "Elizabeth",
      id: "QWRkcmVzczoy",
      lastName: "Vaughn",
      phone: "",
      postalCode: "52203",
      streetAddress1: "419 Ruiz Orchard Apt. 199",
      streetAddress2: "",
    },
    created: "2018-09-11T09:37:30.124154+00:00",
    id: "T3JkZXI6MTk=",
    number: "19",
    paymentStatus: PaymentChargeStatusEnum.FULLY_CHARGED,
    status: OrderStatus.CANCELED,
    total: {
      __typename: "TaxedMoney",
      gross: {
        __typename: "Money",
        amount: 1215.89,
        currency: "USD",
      },
    },
    userEmail: "elizabeth.vaughn@example.com",
  },
  {
    __typename: "Order",
    billingAddress: null,
    created: "2018-09-11T09:37:30.019749+00:00",
    id: "T3JkZXI6MTg=",
    number: "18",
    paymentStatus: PaymentChargeStatusEnum.NOT_CHARGED,
    status: OrderStatus.DRAFT,
    total: {
      __typename: "TaxedMoney",
      gross: {
        __typename: "Money",
        amount: 321.71,
        currency: "USD",
      },
    },
    userEmail: "david.lawson@example.com",
  },
  {
    __typename: "Order",
    billingAddress: {
      __typename: "Address",
      city: "South Rodneymouth",
      cityArea: "",
      companyName: "",
      country: {
        __typename: "CountryDisplay",
        code: "GR",
        country: "Grecja",
      },
      countryArea: "",
      firstName: "Aaron",
      id: "QWRkcmVzczoyOA==",
      lastName: "Randall",
      phone: "",
      postalCode: "30356",
      streetAddress1: "326 Palmer Rapids Apt. 717",
      streetAddress2: "",
    },
    created: "2018-09-11T09:37:29.864391+00:00",
    id: "T3JkZXI6MTc=",
    number: "17",
    paymentStatus: PaymentChargeStatusEnum.NOT_CHARGED,
    status: OrderStatus.CANCELED,
    total: {
      __typename: "TaxedMoney",
      gross: {
        __typename: "Money",
        amount: 271.95,
        currency: "USD",
      },
    },
    userEmail: "aaron.randall@example.com",
  },
  {
    __typename: "Order",
    billingAddress: {
      __typename: "Address",
      city: "Jorgeview",
      cityArea: "",
      companyName: "",
      country: {
        __typename: "CountryDisplay",
        code: "UG",
        country: "Uganda",
      },
      countryArea: "",
      firstName: "Laura",
      id: "QWRkcmVzczoxNA==",
      lastName: "Jensen",
      phone: "",
      postalCode: "77693",
      streetAddress1: "01504 Olson Springs Suite 920",
      streetAddress2: "",
    },
    created: "2018-09-11T09:37:29.610339+00:00",
    id: "T3JkZXI6MTY=",
    number: "16",
    paymentStatus: PaymentChargeStatusEnum.NOT_CHARGED,
    status: OrderStatus.CANCELED,
    total: {
      __typename: "TaxedMoney",
      gross: {
        __typename: "Money",
        amount: 335.84,
        currency: "USD",
      },
    },
    userEmail: "laura.jensen@example.com",
  },
  {
    __typename: "Order",
    billingAddress: {
      __typename: "Address",
      city: "East Lauriestad",
      cityArea: "",
      companyName: "",
      country: {
        __typename: "CountryDisplay",
        code: "PW",
        country: "Palau",
      },
      countryArea: "",
      firstName: "Jenna",
      id: "QWRkcmVzczoyNw==",
      lastName: "Villa",
      phone: "",
      postalCode: "65613",
      streetAddress1: "2031 Mcdonald Mill",
      streetAddress2: "",
    },
    created: "2018-09-11T09:37:29.336209+00:00",
    id: "T3JkZXI6MTU=",
    number: "15",
    paymentStatus: PaymentChargeStatusEnum.NOT_CHARGED,
    status: OrderStatus.CANCELED,
    total: {
      __typename: "TaxedMoney",
      gross: {
        __typename: "Money",
        amount: 1042.15,
        currency: "USD",
      },
    },
    userEmail: "jenna.villa@example.com",
  },
  {
    __typename: "Order",
    billingAddress: {
      __typename: "Address",
      city: "Kaneton",
      cityArea: "",
      companyName: "",
      country: {
        __typename: "CountryDisplay",
        code: "VA",
        country: "Watykan",
      },
      countryArea: "",
      firstName: "Wesley",
      id: "QWRkcmVzczo4",
      lastName: "Davis",
      phone: "",
      postalCode: "66203",
      streetAddress1: "667 Joseph Lights",
      streetAddress2: "",
    },
    created: "2018-09-11T09:37:29.103651+00:00",
    id: "T3JkZXI6MTQ=",
    number: "14",
    paymentStatus: PaymentChargeStatusEnum.NOT_CHARGED,
    status: OrderStatus.CANCELED,
    total: {
      __typename: "TaxedMoney",
      gross: {
        __typename: "Money",
        amount: 213.69,
        currency: "USD",
      },
    },
    userEmail: "wesley.davis@example.com",
  },
  {
    __typename: "Order",
    billingAddress: {
      __typename: "Address",
      city: "New Morganshire",
      cityArea: "",
      companyName: "",
      country: {
        __typename: "CountryDisplay",
        code: "NL",
        country: "Holandia",
      },
      countryArea: "",
      firstName: "Anthony",
      id: "QWRkcmVzczo3",
      lastName: "Gonzalez",
      phone: "",
      postalCode: "78701",
      streetAddress1: "402 Mason Viaduct Suite 592",
      streetAddress2: "",
    },
    created: "2018-09-11T09:37:28.921956+00:00",
    id: "T3JkZXI6MTM=",
    number: "13",
    paymentStatus: PaymentChargeStatusEnum.NOT_CHARGED,
    status: OrderStatus.CANCELED,
    total: {
      __typename: "TaxedMoney",
      gross: {
        __typename: "Money",
        amount: 367.03,
        currency: "USD",
      },
    },
    userEmail: "anthony.gonzalez@example.com",
  },
  {
    __typename: "Order",
    billingAddress: {
      __typename: "Address",
      city: "Adamsport",
      cityArea: "",
      companyName: "",
      country: {
        __typename: "CountryDisplay",
        code: "TN",
        country: "Tunezja",
      },
      countryArea: "",
      firstName: "Denise",
      id: "QWRkcmVzczoyNg==",
      lastName: "Freeman",
      phone: "",
      postalCode: "27744",
      streetAddress1: "8376 Linda Valley Apt. 934",
      streetAddress2: "",
    },
    created: "2018-09-11T09:37:28.750718+00:00",
    id: "T3JkZXI6MTI=",
    number: "12",
    paymentStatus: PaymentChargeStatusEnum.NOT_CHARGED,
    status: OrderStatus.CANCELED,
    total: {
      __typename: "TaxedMoney",
      gross: {
        __typename: "Money",
        amount: 298.76,
        currency: "USD",
      },
    },
    userEmail: "denise.freeman@example.com",
  },
  {
    __typename: "Order",
    billingAddress: {
      __typename: "Address",
      city: "Thomasburgh",
      cityArea: "",
      companyName: "",
      country: {
        __typename: "CountryDisplay",
        code: "DJ",
        country: "Dżibuti",
      },
      countryArea: "",
      firstName: "James",
      id: "QWRkcmVzczo2",
      lastName: "Ball",
      phone: "",
      postalCode: "70958",
      streetAddress1: "60049 Fisher Grove",
      streetAddress2: "",
    },
    created: "2018-09-11T09:37:28.598246+00:00",
    id: "T3JkZXI6MTE=",
    number: "11",
    paymentStatus: PaymentChargeStatusEnum.FULLY_CHARGED,
    status: OrderStatus.UNFULFILLED,
    total: {
      __typename: "TaxedMoney",
      gross: {
        __typename: "Money",
        amount: 663.69,
        currency: "USD",
      },
    },
    userEmail: "james.ball@example.com",
  },
  {
    __typename: "Order",
    billingAddress: {
      __typename: "Address",
      city: "Lake Walter",
      cityArea: "",
      companyName: "",
      country: {
        __typename: "CountryDisplay",
        code: "MK",
        country: "Macedonia",
      },
      countryArea: "",
      firstName: "Michael",
      id: "QWRkcmVzczoz",
      lastName: "Martinez",
      phone: "",
      postalCode: "11343",
      streetAddress1: "843 Allen Ramp Suite 194",
      streetAddress2: "",
    },
    created: "2018-09-11T09:37:28.409836+00:00",
    id: "T3JkZXI6MTA=",
    number: "10",
    paymentStatus: PaymentChargeStatusEnum.NOT_CHARGED,
    status: OrderStatus.CANCELED,
    total: {
      __typename: "TaxedMoney",
      gross: {
        __typename: "Money",
        amount: 280.41,
        currency: "USD",
      },
    },
    userEmail: "michael.martinez@example.com",
  },
  {
    __typename: "Order",
    billingAddress: {
      __typename: "Address",
      city: "West Patriciastad",
      cityArea: "",
      companyName: "",
      country: {
        __typename: "CountryDisplay",
        code: "SB",
        country: "Wyspy Salomona",
      },
      countryArea: "",
      firstName: "Melissa",
      id: "QWRkcmVzczoyNQ==",
      lastName: "Simon",
      phone: "",
      postalCode: "66272",
      streetAddress1: "487 Roberto Shores",
      streetAddress2: "",
    },
    created: "2018-09-11T09:37:28.185874+00:00",
    id: "T3JkZXI6OQ==",
    number: "9",
    paymentStatus: PaymentChargeStatusEnum.NOT_CHARGED,
    status: OrderStatus.PARTIALLY_FULFILLED,
    total: {
      __typename: "TaxedMoney",
      gross: {
        __typename: "Money",
        amount: 234.93,
        currency: "USD",
      },
    },
    userEmail: "melissa.simon@example.com",
  },
  {
    __typename: "Order",
    billingAddress: {
      __typename: "Address",
      city: "Lake Kevinchester",
      cityArea: "",
      companyName: "",
      country: {
        __typename: "CountryDisplay",
        code: "CL",
        country: "Chile",
      },
      countryArea: "",
      firstName: "Justin",
      id: "QWRkcmVzczoyNA==",
      lastName: "Mccoy",
      phone: "",
      postalCode: "03826",
      streetAddress1: "74416 Jensen Gateway Suite 140",
      streetAddress2: "",
    },
    created: "2018-09-11T09:37:27.953588+00:00",
    id: "T3JkZXI6OA==",
    number: "8",
    paymentStatus: PaymentChargeStatusEnum.NOT_CHARGED,
    status: OrderStatus.PARTIALLY_FULFILLED,
    total: {
      __typename: "TaxedMoney",
      gross: {
        __typename: "Money",
        amount: 485.19,
        currency: "USD",
      },
    },
    userEmail: "justin.mccoy@example.com",
  },
  {
    __typename: "Order",
    billingAddress: {
      __typename: "Address",
      city: "New Morganshire",
      cityArea: "",
      companyName: "",
      country: {
        __typename: "CountryDisplay",
        code: "NL",
        country: "Holandia",
      },
      countryArea: "",
      firstName: "Anthony",
      id: "QWRkcmVzczo3",
      lastName: "Gonzalez",
      phone: "",
      postalCode: "78701",
      streetAddress1: "402 Mason Viaduct Suite 592",
      streetAddress2: "",
    },
    created: "2018-09-11T09:37:27.828033+00:00",
    id: "T3JkZXI6Nw==",
    number: "7",
    paymentStatus: PaymentChargeStatusEnum.FULLY_CHARGED,
    status: OrderStatus.PARTIALLY_FULFILLED,
    total: {
      __typename: "TaxedMoney",
      gross: {
        __typename: "Money",
        amount: 223.54,
        currency: "USD",
      },
    },
    userEmail: "anthony.gonzalez@example.com",
  },
  {
    __typename: "Order",
    billingAddress: {
      __typename: "Address",
      city: "Gabrielchester",
      cityArea: "",
      companyName: "",
      country: {
        __typename: "CountryDisplay",
        code: "SN",
        country: "Senegal",
      },
      countryArea: "",
      firstName: "Bradley",
      id: "QWRkcmVzczoyMw==",
      lastName: "Ford",
      phone: "",
      postalCode: "88661",
      streetAddress1: "56414 Ashley Gardens",
      streetAddress2: "",
    },
    created: "2018-09-11T09:37:27.636741+00:00",
    id: "T3JkZXI6Ng==",
    number: "6",
    paymentStatus: PaymentChargeStatusEnum.NOT_CHARGED,
    status: OrderStatus.FULFILLED,
    total: {
      __typename: "TaxedMoney",
      gross: {
        __typename: "Money",
        amount: 237.55,
        currency: "USD",
      },
    },
    userEmail: "bradley.ford@example.com",
  },
  {
    __typename: "Order",
    billingAddress: {
      __typename: "Address",
      city: "East Steven",
      cityArea: "",
      companyName: "",
      country: {
        __typename: "CountryDisplay",
        code: "CG",
        country: "Kongo",
      },
      countryArea: "",
      firstName: "David",
      id: "QWRkcmVzczoxNg==",
      lastName: "Lawson",
      phone: "",
      postalCode: "87510",
      streetAddress1: "151 Huang Pines",
      streetAddress2: "",
    },
    created: "2018-09-11T09:37:27.420590+00:00",
    id: "T3JkZXI6NQ==",
    number: "5",
    paymentStatus: PaymentChargeStatusEnum.NOT_CHARGED,
    status: OrderStatus.PARTIALLY_FULFILLED,
    total: {
      __typename: "TaxedMoney",
      gross: {
        __typename: "Money",
        amount: 453.55,
        currency: "USD",
      },
    },
    userEmail: "david.lawson@example.com",
  },
  {
    __typename: "Order",
    billingAddress: {
      __typename: "Address",
      city: "East Daniel",
      cityArea: "",
      companyName: "",
      country: {
        __typename: "CountryDisplay",
        code: "NA",
        country: "Namibia",
      },
      countryArea: "",
      firstName: "Lauren",
      id: "QWRkcmVzczoyMg==",
      lastName: "Watson",
      phone: "",
      postalCode: "22102",
      streetAddress1: "340 Amanda Tunnel Suite 869",
      streetAddress2: "",
    },
    created: "2018-09-11T09:37:27.230990+00:00",
    id: "T3JkZXI6NA==",
    number: "4",
    paymentStatus: PaymentChargeStatusEnum.NOT_CHARGED,
    status: OrderStatus.PARTIALLY_FULFILLED,
    total: {
      __typename: "TaxedMoney",
      gross: {
        __typename: "Money",
        amount: 812.67,
        currency: "USD",
      },
    },
    userEmail: "lauren.watson@example.com",
  },
  {
    __typename: "Order",
    billingAddress: {
      __typename: "Address",
      city: "Lake Margaret",
      cityArea: "",
      companyName: "",
      country: {
        __typename: "CountryDisplay",
        code: "CO",
        country: "Kolumbia",
      },
      countryArea: "",
      firstName: "Mark",
      id: "QWRkcmVzczoxNQ==",
      lastName: "Lee",
      phone: "",
      postalCode: "18829",
      streetAddress1: "34480 Daniel Centers Apt. 642",
      streetAddress2: "",
    },
    created: "2018-09-11T09:37:26.972507+00:00",
    id: "T3JkZXI6Mw==",
    number: "3",
    paymentStatus: PaymentChargeStatusEnum.NOT_CHARGED,
    status: OrderStatus.PARTIALLY_FULFILLED,
    total: {
      __typename: "TaxedMoney",
      gross: {
        __typename: "Money",
        amount: 481.41,
        currency: "USD",
      },
    },
    userEmail: "mark.lee@example.com",
  },
  {
    __typename: "Order",
    billingAddress: {
      __typename: "Address",
      city: "Dorothyberg",
      cityArea: "",
      companyName: "",
      country: {
        __typename: "CountryDisplay",
        code: "BJ",
        country: "Benin",
      },
      countryArea: "",
      firstName: "Kara",
      id: "QWRkcmVzczoyMQ==",
      lastName: "Murphy",
      phone: "",
      postalCode: "88138",
      streetAddress1: "0674 Kent Station Suite 395",
      streetAddress2: "",
    },
    created: "2018-09-11T09:37:26.751359+00:00",
    id: "T3JkZXI6Mg==",
    number: "2",
    paymentStatus: PaymentChargeStatusEnum.FULLY_CHARGED,
    status: OrderStatus.PARTIALLY_FULFILLED,
    total: {
      __typename: "TaxedMoney",
      gross: {
        __typename: "Money",
        amount: 569.19,
        currency: "USD",
      },
    },
    userEmail: "kara.murphy@example.com",
  },
  {
    __typename: "Order",
    billingAddress: {
      __typename: "Address",
      city: "Gregorymouth",
      cityArea: "",
      companyName: "",
      country: {
        __typename: "CountryDisplay",
        code: "CV",
        country: "Republika Zielonego Przylądka",
      },
      countryArea: "",
      firstName: "Curtis",
      id: "QWRkcmVzczox",
      lastName: "Bailey",
      phone: "",
      postalCode: "84525",
      streetAddress1: "839 Scott Lake",
      streetAddress2: "",
    },
    created: "2018-09-11T09:37:26.314968+00:00",
    id: "T3JkZXI6MQ==",
    number: "1",
    paymentStatus: PaymentChargeStatusEnum.FULLY_CHARGED,
    status: OrderStatus.PARTIALLY_FULFILLED,
    total: {
      __typename: "TaxedMoney",
      gross: {
        __typename: "Money",
        amount: 557,
        currency: "USD",
      },
    },
    userEmail: "curtis.bailey@example.com",
  },
];

export const ORDER_AMOUNT = 234.93;

export const order = (
  placeholder: string,
): OrderDetailsWithMetadataFragment => ({
  __typename: "Order",
  giftCards: [],
  actions: [
    OrderAction.CAPTURE,
    OrderAction.MARK_AS_PAID,
    OrderAction.REFUND,
    OrderAction.VOID,
  ],
  shippingMethods: [
    {
      __typename: "ShippingMethod",
      id: "U2hpcHBpbmdNZXRob2Q6NQ==",
      name: "FBA",
      price: {
        __typename: "Money",
        amount: 12.41,
        currency: "USD",
      },
      active: false,
      message: "shipping method is disactive",
    },
    {
      __typename: "ShippingMethod",
      id: "U2hpcHBpbmdNZXRob2Q6Nw==",
      name: "Oceania Air Mail",
      price: {
        __typename: "Money",
        amount: 9.12,
        currency: "USD",
      },
      active: true,
      message: null,
    },
    {
      __typename: "ShippingMethod",
      id: "U2hpcHBpbmdNZXRob2Q6Ng==",
      name: "FedEx Express",
      price: {
        __typename: "Money",
        amount: 7.6,
        currency: "USD",
      },
      active: true,
      message: null,
    },
  ],
  billingAddress: {
    __typename: "Address",
    city: "West Patriciastad",
    cityArea: "",
    companyName: "",
    country: {
      __typename: "CountryDisplay",
      code: "SB",
      country: "Wyspy Salomona",
    },
    countryArea: "",
    firstName: "Melissa",
    id: "QWRkcmVzczoyNQ==",
    lastName: "Simon",
    phone: "",
    postalCode: "66272",
    streetAddress1: "487 Roberto Shores",
    streetAddress2: "",
  },
  canFinalize: true,
  channel: {
    __typename: "Channel",
    slug: "channel-default",
    currencyCode: "USD",
    id: "123454",
    isActive: true,
    name: "Default Channel",
    orderSettings: {
      markAsPaidStrategy: MarkAsPaidStrategyEnum.TRANSACTION_FLOW,
      __typename: "OrderSettings",
    },
    defaultCountry: {
      code: "CA",
      __typename: "CountryDisplay",
    },
  },
  created: "2018-09-11T09:37:28.185874+00:00",
  customerNote: "Lorem ipsum dolor sit amet",
  discounts: [],
  events: [
    {
      __typename: "OrderEvent",
      amount: null,
      date: "2018-09-17T13:22:24.376193+00:00",
      discount: null,
      email: null,
      emailType: null,
      id: "T3JkZXJFdmVudDoyMQ==",
      invoiceNumber: null,
      lines: [],
      message: null,
      quantity: 1,
      relatedOrder: null,
      shippingCostsIncluded: false,
      transactionReference: "123",
      type: OrderEventsEnum.FULFILLMENT_FULFILLED_ITEMS,
      app: {
        id: "ZXCkcmVasdwoxTW==",
        __typename: "App",
        name: "Testapp",
        appUrl: "https://www.google.com/",
      },
      user: {
        __typename: "User",
        email: "admin@example.com",
        firstName: "John",
        id: "QWRkcmVzczoxNQ==",
        lastName: "Doe",
      },
    },
    {
      __typename: "OrderEvent",
      amount: null,
      date: "2018-09-17T13:22:24.376193+00:00",
      discount: null,
      email: null,
      emailType: null,
      id: "UYgDNUnnfyiuyimuhd==",
      invoiceNumber: null,
      lines: [
        {
          __typename: "OrderEventOrderLineObject",
          discount: null,
          itemName: "Cow's milk",
          orderLine: {
            __typename: "OrderLine",
            id: "h47gfncfgwegfehfhj",
            productName: "Milk",
            variantName: "Cow's milk",
          },
          quantity: 4,
        },
        {
          __typename: "OrderEventOrderLineObject",
          discount: null,
          itemName: "Goat's milk",
          orderLine: {
            __typename: "OrderLine",
            id: "7846f857t4t84y8fgh",
            productName: "Milk",
            variantName: "Goat's milk",
          },
          quantity: 4,
        },
      ],
      message: null,
      quantity: 1,
      relatedOrder: null,
      shippingCostsIncluded: true,
      transactionReference: "123",
      type: OrderEventsEnum.FULFILLMENT_REFUNDED,
      app: {
        id: "ZXCkcmVasdwoxTW==",
        __typename: "App",
        name: "Testapp",
        appUrl: "https://www.google.com/",
      },
      user: {
        __typename: "User",
        email: "admin@example.com",
        firstName: "Jane",
        id: "QWRkcmVzczoxNQ==",
        lastName: "Doe",
      },
    },
    {
      __typename: "OrderEvent",
      amount: null,
      date: "2019-09-17T13:22:24.376193+00:00",
      discount: null,
      email: null,
      emailType: null,
      id: "T3JkZXJFdmVudDo0",
      invoiceNumber: null,
      lines: [],
      message: "This is note",
      quantity: null,
      relatedOrder: null,
      shippingCostsIncluded: false,
      transactionReference: "124",
      type: OrderEventsEnum.NOTE_ADDED,
      user: null,
      app: null,
    },
    {
      __typename: "OrderEvent",
      amount: null,
      date: "2019-09-17T13:22:24.376193+00:00",
      discount: null,
      email: null,
      emailType: null,
      id: "T3JkZXJFdmVudDo1",
      invoiceNumber: null,
      lines: [],
      message: "This is note",
      quantity: null,
      relatedOrder: null,
      shippingCostsIncluded: false,
      transactionReference: "125",
      type: OrderEventsEnum.NOTE_ADDED,
      user: null,
      app: null,
    },
    {
      __typename: "OrderEvent",
      amount: null,
      date: "2019-09-17T13:22:24.376193+00:00",
      discount: null,
      email: null,
      emailType: null,
      id: "T3JkZXJFdmVudDo2",
      invoiceNumber: null,
      lines: [],
      message: "Note from external service",
      quantity: null,
      relatedOrder: null,
      shippingCostsIncluded: false,
      transactionReference: "126",
      type: OrderEventsEnum.EXTERNAL_SERVICE_NOTIFICATION,
      user: null,
      app: null,
    },
    {
      __typename: "OrderEvent",
      amount: null,
      date: "2019-09-17T13:22:24.376193+00:00",
      discount: null,
      email: null,
      emailType: OrderEventsEmailsEnum.ORDER_CANCEL,
      id: "T3JkZXJFdmVudDo3",
      invoiceNumber: null,
      lines: [],
      message: null,
      quantity: null,
      relatedOrder: null,
      shippingCostsIncluded: false,
      transactionReference: "127",
      type: OrderEventsEnum.EMAIL_SENT,
      user: null,
      app: null,
    },
    {
      __typename: "OrderEvent",
      amount: null,
      date: "2019-09-17T13:22:24.376193+00:00",
      discount: null,
      email: null,
      emailType: OrderEventsEmailsEnum.ORDER_REFUND,
      id: "T3JkZXJFdmVudDo4",
      invoiceNumber: null,
      lines: [],
      message: null,
      quantity: null,
      relatedOrder: null,
      shippingCostsIncluded: false,
      transactionReference: "128",
      type: OrderEventsEnum.EMAIL_SENT,
      user: null,
      app: null,
    },
    {
      __typename: "OrderEvent",
      amount: null,
      date: "2019-09-17T13:22:24.376193+00:00",
      discount: null,
      email: null,
      emailType: null,
      id: "T3JkZXJFdmVudDo5",
      invoiceNumber: null,
      lines: [],
      message: null,
      quantity: null,
      relatedOrder: null,
      shippingCostsIncluded: false,
      transactionReference: "129",
      type: OrderEventsEnum.PAYMENT_AUTHORIZED,
      user: null,
      app: null,
    },
  ],
  fulfillments: [
    {
      __typename: "Fulfillment",
      fulfillmentOrder: 2,
      id: "RnVsZmlsbG1lbnQ6MjQ=",
      metadata: [],
      privateMetadata: [],
      lines: [
        {
          __typename: "FulfillmentLine",
          id: "RnVsZmlsbG1lbnRMaW5lOjM5",
          orderLine: {
            __typename: "OrderLine",
            id: "T3JkZXJMaW5lOjIz",
            isShippingRequired: false,
            productName: "Williams, Garcia and Walker (XS)",
            productSku: "5-1337",
            quantity: 2,
            quantityFulfilled: 2,
            quantityToFulfill: 0,
            isGift: false,
            allocations: [
              {
                id: "allocation_test_id",
                warehouse: {
                  name: "US Warehouse",
                  id: "V2FyZWhvdXNlOjk1NWY0ZDk2LWRmNTAtNGY0Zi1hOTM4LWM5MTYzYTA4YTViNg==",
                  __typename: "Warehouse",
                },
                quantity: 1,
                __typename: "Allocation",
              },
            ],
            thumbnail: {
              __typename: "Image" as "Image",
              url: placeholder,
            },
            totalPrice: {
              __typename: "TaxedMoney",
              gross: {
                __typename: "Money",
                amount: 159.42,
                currency: "USD",
              },
              net: {
                __typename: "Money",
                amount: 159.42,
                currency: "USD",
              },
            },
            undiscountedUnitPrice: {
              __typename: "TaxedMoney",
              currency: "USD",
              gross: {
                __typename: "Money",
                amount: 79.71,
                currency: "USD",
              },
              net: {
                __typename: "Money",
                amount: 79.71,
                currency: "USD",
              },
            },
            unitDiscount: {
              __typename: "Money",
              amount: 79.71,
              currency: "USD",
            },
            unitDiscountReason: null,
            unitDiscountType: null,
            unitDiscountValue: 0,
            unitPrice: {
              __typename: "TaxedMoney",
              gross: {
                __typename: "Money",
                amount: 79.71,
                currency: "USD",
              },
              net: {
                __typename: "Money",
                amount: 79.71,
                currency: "USD",
              },
            },
            variant: {
              __typename: "ProductVariant",
              id: "dsfsfuhb",
              name: "XS",
              quantityAvailable: 10,
              preorder: null,
              metadata: [],
              privateMetadata: [],
              product: {
                __typename: "Product",
                id: "UHJvZHVjdDo1",
                isAvailableForPurchase: true,
              },
              stocks: [
                {
                  id: "stock_test_id1",
                  warehouse: {
                    name: "stock_warehouse1",
                    id: "V2FyZWhvdXNlOjc4OGUyMGRlLTlmYTAtNDI5My1iZDk2LWUwM2RjY2RhMzc0ZQ==",
                    __typename: "Warehouse",
                  },
                  quantity: 166,
                  quantityAllocated: 0,
                  __typename: "Stock",
                },
                {
                  id: "stock_test_id2",
                  warehouse: {
                    name: "stock_warehouse2",
                    id: "V2FyZWhvdXNlOjczYzI0OGNmLTliNzAtNDlmMi1hMDRlLTM4ZTYxMmQ5MDYwMQ==",
                    __typename: "Warehouse",
                  },
                  quantity: 166,
                  quantityAllocated: 0,
                  __typename: "Stock",
                },
              ],
            },
          },
          quantity: 1,
        },
      ],
      status: FulfillmentStatus.FULFILLED,
      trackingNumber: "",
      warehouse: warehouseList[1],
    },
    {
      __typename: "Fulfillment",
      fulfillmentOrder: 1,
      id: "RnVsZmlsbG1lbnQ6OQ==",
      metadata: [],
      privateMetadata: [],
      lines: [
        {
          __typename: "FulfillmentLine",
          id: "RnVsZmlsbG1lbnRMaW5lOjE1",
          orderLine: {
            __typename: "OrderLine",
            id: "T3JkZXJMaW5lOjIz",
            isShippingRequired: false,
            productName: "Williams, Garcia and Walker (XS)",
            productSku: "5-1337",
            quantity: 2,
            quantityFulfilled: 2,
            quantityToFulfill: 0,
            isGift: false,
            allocations: [
              {
                id: "allocation_test_id",
                warehouse: {
                  name: "US Warehouse",
                  id: "V2FyZWhvdXNlOjk1NWY0ZDk2LWRmNTAtNGY0Zi1hOTM4LWM5MTYzYTA4YTViNg==",
                  __typename: "Warehouse",
                },
                quantity: 1,
                __typename: "Allocation",
              },
            ],
            thumbnail: {
              __typename: "Image" as "Image",
              url: placeholder,
            },
            totalPrice: {
              __typename: "TaxedMoney",
              gross: {
                __typename: "Money",
                amount: 159.42,
                currency: "USD",
              },
              net: {
                __typename: "Money",
                amount: 159.42,
                currency: "USD",
              },
            },
            undiscountedUnitPrice: {
              __typename: "TaxedMoney",
              currency: "USD",
              gross: {
                __typename: "Money",
                amount: 79.71,
                currency: "USD",
              },
              net: {
                __typename: "Money",
                amount: 79.71,
                currency: "USD",
              },
            },
            unitDiscount: {
              __typename: "Money",
              amount: 79.71,
              currency: "USD",
            },
            unitDiscountReason: null,
            unitDiscountType: null,
            unitDiscountValue: 0,
            unitPrice: {
              __typename: "TaxedMoney",
              gross: {
                __typename: "Money",
                amount: 79.71,
                currency: "USD",
              },
              net: {
                __typename: "Money",
                amount: 79.71,
                currency: "USD",
              },
            },
            variant: {
              __typename: "ProductVariant",
              id: "dsfsfuhb",
              name: "XS",
              quantityAvailable: 10,
              preorder: null,
              metadata: [],
              privateMetadata: [],
              product: {
                __typename: "Product",
                id: "UHJvZHVjdDo1",
                isAvailableForPurchase: true,
              },
              stocks: [
                {
                  id: "stock_test_id1",
                  warehouse: {
                    name: "stock_warehouse1",
                    id: "V2FyZWhvdXNlOjc4OGUyMGRlLTlmYTAtNDI5My1iZDk2LWUwM2RjY2RhMzc0ZQ==",
                    __typename: "Warehouse",
                  },
                  quantity: 166,
                  quantityAllocated: 0,
                  __typename: "Stock",
                },
                {
                  id: "stock_test_id2",
                  warehouse: {
                    name: "stock_warehouse2",
                    id: "V2FyZWhvdXNlOjczYzI0OGNmLTliNzAtNDlmMi1hMDRlLTM4ZTYxMmQ5MDYwMQ==",
                    __typename: "Warehouse",
                  },
                  quantity: 166,
                  quantityAllocated: 0,
                  __typename: "Stock",
                },
              ],
            },
          },
          quantity: 1,
        },
      ],
      status: FulfillmentStatus.FULFILLED,
      trackingNumber: "01nn12399su12nndfsy",
      warehouse: warehouseList[0],
    },
  ],
  id: "T3JkZXI6OQ==",
  token: "e5cfc543-6a62-472f-8b80-6a2311f9ff14",
  invoices: [
    {
      __typename: "Invoice",
      createdAt: "2020-06-22T13:52:05.094636+00:00",
      id: "SW52b2ljZTox",
      number: "1",
      status: JobStatusEnum.SUCCESS,
      url: "invoice1",
    },
  ],
  isPaid: true,
  isShippingRequired: false,
  lines: [
    {
      __typename: "OrderLine",
      id: "T3JkZXJMaW5lOjIy",
      isShippingRequired: true,
      productName: "Watkins-Gonzalez (Soft)",
      productSku: "59-1337",
      quantity: 3,
      quantityFulfilled: 0,
      quantityToFulfill: 3,
      isGift: false,
      allocations: [
        {
          id: "allocation_test_id",
          warehouse: {
            name: "US Warehouse",
            id: "V2FyZWhvdXNlOjk1NWY0ZDk2LWRmNTAtNGY0Zi1hOTM4LWM5MTYzYTA4YTViNg==",
            __typename: "Warehouse",
          },
          quantity: 1,
          __typename: "Allocation",
        },
      ],
      thumbnail: {
        __typename: "Image" as "Image",
        url: placeholder,
      },
      totalPrice: {
        __typename: "TaxedMoney",
        gross: {
          __typename: "Money",
          amount: 55.53,
          currency: "USD",
        },
        net: {
          __typename: "Money",
          amount: 55.53,
          currency: "USD",
        },
      },
      undiscountedUnitPrice: {
        __typename: "TaxedMoney",
        currency: "USD",
        gross: {
          __typename: "Money",
          amount: 18.51,
          currency: "USD",
        },
        net: {
          __typename: "Money",
          amount: 18.51,
          currency: "USD",
        },
      },
      unitDiscount: {
        __typename: "Money",
        amount: 79.71,
        currency: "USD",
      },
      unitDiscountReason: null,
      unitDiscountType: null,
      unitDiscountValue: 0,
      unitPrice: {
        __typename: "TaxedMoney",
        gross: {
          __typename: "Money",
          amount: 18.51,
          currency: "USD",
        },
        net: {
          __typename: "Money",
          amount: 18.51,
          currency: "USD",
        },
      },
      variant: {
        __typename: "ProductVariant",
        id: "dsfsfuhb",
        name: "Soft",
        quantityAvailable: 10,
        preorder: null,
        metadata: [],
        privateMetadata: [],
        product: {
          __typename: "Product",
          id: "UHJvZHVjdDo1",
          isAvailableForPurchase: true,
        },
        stocks: [
          {
            id: "stock_test_id1",
            warehouse: {
              name: "stock_warehouse1",
              id: "V2FyZWhvdXNlOjc4OGUyMGRlLTlmYTAtNDI5My1iZDk2LWUwM2RjY2RhMzc0ZQ==",
              __typename: "Warehouse",
            },
            quantity: 166,
            quantityAllocated: 0,
            __typename: "Stock",
          },
          {
            id: "stock_test_id2",
            warehouse: {
              name: "stock_warehouse2",
              id: "V2FyZWhvdXNlOjczYzI0OGNmLTliNzAtNDlmMi1hMDRlLTM4ZTYxMmQ5MDYwMQ==",
              __typename: "Warehouse",
            },
            quantity: 166,
            quantityAllocated: 0,
            __typename: "Stock",
          },
        ],
      },
    },
    {
      __typename: "OrderLine",
      id: "T3JkZXJMaW5lOjIz",
      isShippingRequired: true,
      productName: "Williams, Garcia and Walker (XS)",
      productSku: "5-1337",
      quantity: 2,
      quantityFulfilled: 2,
      quantityToFulfill: 0,
      isGift: false,
      allocations: [
        {
          id: "allocation_test_id",
          warehouse: {
            name: "US Warehouse",
            id: "V2FyZWhvdXNlOjk1NWY0ZDk2LWRmNTAtNGY0Zi1hOTM4LWM5MTYzYTA4YTViNg==",
            __typename: "Warehouse",
          },
          quantity: 1,
          __typename: "Allocation",
        },
      ],
      thumbnail: {
        __typename: "Image" as "Image",
        url: placeholder,
      },
      totalPrice: {
        __typename: "TaxedMoney",
        gross: {
          __typename: "Money",
          amount: 159.42,
          currency: "USD",
        },
        net: {
          __typename: "Money",
          amount: 159.42,
          currency: "USD",
        },
      },
      undiscountedUnitPrice: {
        __typename: "TaxedMoney",
        currency: "USD",
        gross: {
          __typename: "Money",
          amount: 79.71,
          currency: "USD",
        },
        net: {
          __typename: "Money",
          amount: 79.71,
          currency: "USD",
        },
      },
      unitDiscount: {
        __typename: "Money",
        amount: 79.71,
        currency: "USD",
      },
      unitDiscountReason: null,
      unitDiscountType: null,
      unitDiscountValue: 0,
      unitPrice: {
        __typename: "TaxedMoney",
        gross: {
          __typename: "Money",
          amount: 79.71,
          currency: "USD",
        },
        net: {
          __typename: "Money",
          amount: 79.71,
          currency: "USD",
        },
      },
      variant: {
        __typename: "ProductVariant",
        id: "dsfsfuhb",
        name: "XXL",
        quantityAvailable: 10,
        preorder: null,
        metadata: [],
        privateMetadata: [],
        product: {
          __typename: "Product",
          id: "UHJvZHVjdDo1",
          isAvailableForPurchase: true,
        },
        stocks: [
          {
            id: "stock_test_id1",
            warehouse: {
              name: "stock_warehouse1",
              id: "V2FyZWhvdXNlOjc4OGUyMGRlLTlmYTAtNDI5My1iZDk2LWUwM2RjY2RhMzc0ZQ==",
              __typename: "Warehouse",
            },
            quantity: 166,
            quantityAllocated: 0,
            __typename: "Stock",
          },
          {
            id: "stock_test_id2",
            warehouse: {
              name: "stock_warehouse2",
              id: "V2FyZWhvdXNlOjczYzI0OGNmLTliNzAtNDlmMi1hMDRlLTM4ZTYxMmQ5MDYwMQ==",
              __typename: "Warehouse",
            },
            quantity: 166,
            quantityAllocated: 0,
            __typename: "Stock",
          },
        ],
      },
    },
  ],
  metadata: [
    {
      __typename: "MetadataItem",
      key: "integration.key",
      value: "some-value",
    },
  ],
  number: "9",
  paymentStatus: PaymentChargeStatusEnum.NOT_CHARGED,
  privateMetadata: [],
  shippingAddress: {
    __typename: "Address",
    city: "West Patriciastad",
    cityArea: "",
    companyName: "",
    country: {
      __typename: "CountryDisplay",
      code: "SB",
      country: "Wyspy Salomona",
    },
    countryArea: "",
    firstName: "Melissa",
    id: "QWRkcmVzczoyNQ==",
    lastName: "Simon",
    phone: "",
    postalCode: "66272",
    streetAddress1: "487 Roberto Shores",
    streetAddress2: "",
  },
  shippingMethod: null,
  shippingMethodName: "Registred priority",
  collectionPointName: "Warehouse",
  deliveryMethod: warehouseForPickup,
  shippingPrice: {
    __typename: "TaxedMoney",
    gross: {
      __typename: "Money",
      amount: 19.98,
      currency: "USD",
    },
  },
  status: OrderStatus.PARTIALLY_FULFILLED,
  subtotal: {
    __typename: "TaxedMoney",
    gross: {
      __typename: "Money",
      amount: 214.95,
      currency: "USD",
    },
    net: {
      __typename: "Money",
      amount: 214.95,
      currency: "USD",
    },
  },
  total: {
    __typename: "TaxedMoney",
    gross: {
      __typename: "Money",
      amount: 234.93,
      currency: "USD",
    },
    net: {
      __typename: "Money",
      amount: 234.93,
      currency: "USD",
    },
    tax: {
      __typename: "Money",
      amount: 0,
      currency: "USD",
    },
  },
  totalAuthorized: prepareMoney(234.93),
  totalCaptured: prepareMoney(0),
  totalBalance: {
    __typename: "Money",
    amount: 0,
    currency: "USD",
  },
  undiscountedTotal: {
    __typename: "TaxedMoney",
    gross: {
      __typename: "Money",
      amount: 79.71,
      currency: "USD",
    },
    net: {
      __typename: "Money",
      amount: 79.71,
      currency: "USD",
    },
  },
  user: null,
  userEmail: "melissa.simon@example.com",
  payments: [],
  grantedRefunds: [],
  totalGrantedRefund: prepareMoney(0),
  totalAuthorizePending: prepareMoney(0),
  totalCharged: prepareMoney(0),
  totalChargePending: prepareMoney(0),
  totalRefunded: prepareMoney(0),
  totalRefundPending: prepareMoney(0),
  totalCanceled: prepareMoney(0),
  totalCancelPending: prepareMoney(0),
  totalRemainingGrant: prepareMoney(0),
  transactions: orderTransactions,
});

export const draftOrder = (
  placeholder: string,
): OrderDetailsWithMetadataFragment => ({
  __typename: "Order" as "Order",
  giftCards: [],
  actions: [OrderAction.CAPTURE],
  shippingMethods: [],
  billingAddress: null,
  canFinalize: true,
  grantedRefunds: [],
  totalGrantedRefund: prepareMoney(0),
  totalAuthorizePending: prepareMoney(0),
  totalCharged: prepareMoney(0),
  totalChargePending: prepareMoney(0),
  totalRefunded: prepareMoney(0),
  totalRefundPending: prepareMoney(0),
  totalCanceled: prepareMoney(0),
  totalCancelPending: prepareMoney(0),
  totalRemainingGrant: prepareMoney(0),
  transactions: orderTransactions,
  payments: [],
  channel: {
    __typename: "Channel",
    slug: "channel-default",
    currencyCode: "USD",
    id: "123454",
    isActive: true,
    name: "Default Channel",
    orderSettings: {
      markAsPaidStrategy: MarkAsPaidStrategyEnum.TRANSACTION_FLOW,
      __typename: "OrderSettings",
    },
    defaultCountry: {
      code: "CA",
      __typename: "CountryDisplay",
    },
  },
  created: "2018-09-20T23:23:39.811428+00:00",
  customerNote: "Lorem ipsum dolor sit",
  discounts: [],
  events: [],
  fulfillments: [],
  id: "T3JkZXI6MjQ=",
  token: "e5cfc543-6a62-472f-8b80-6a2311f9ff14",
  invoices: [
    {
      __typename: "Invoice",
      createdAt: "2020-06-22T13:52:05.094636+00:00",
      id: "SW52b2ljZTox",
      number: "1",
      status: JobStatusEnum.SUCCESS,
      url: "invoice1",
    },
  ],
  isPaid: false,
  isShippingRequired: false,
  lines: [
    {
      __typename: "OrderLine" as "OrderLine",
      id: "T3JkZXJMaW5lOjQ1",
      isShippingRequired: false,
      productName: "Davis Group (Hard)",
      productSku: "58-1338",
      quantity: 2,
      quantityFulfilled: 0,
      quantityToFulfill: 2,
      isGift: false,
      allocations: [
        {
          id: "allocation_test_id",
          warehouse: {
            name: "US Warehouse",
            id: "V2FyZWhvdXNlOjk1NWY0ZDk2LWRmNTAtNGY0Zi1hOTM4LWM5MTYzYTA4YTViNg==",
            __typename: "Warehouse",
          },
          quantity: 1,
          __typename: "Allocation",
        },
      ],
      thumbnail: {
        __typename: "Image" as "Image",
        url: placeholder,
      },
      totalPrice: {
        __typename: "TaxedMoney",
        gross: {
          __typename: "Money",
          amount: 159.42,
          currency: "USD",
        },
        net: {
          __typename: "Money",
          amount: 159.42,
          currency: "USD",
        },
      },
      undiscountedUnitPrice: {
        __typename: "TaxedMoney",
        currency: "USD",
        gross: {
          __typename: "Money",
          amount: 79.71,
          currency: "USD",
        },
        net: {
          __typename: "Money",
          amount: 79.71,
          currency: "USD",
        },
      },
      unitDiscount: {
        __typename: "Money",
        amount: 79.71,
        currency: "USD",
      },
      unitDiscountReason: null,
      unitDiscountType: null,
      unitDiscountValue: 0,
      unitPrice: {
        __typename: "TaxedMoney" as "TaxedMoney",
        gross: {
          __typename: "Money" as "Money",
          amount: 65.95,
          currency: "USD",
        },
        net: {
          __typename: "Money" as "Money",
          amount: 65.95,
          currency: "USD",
        },
      },
      variant: {
        __typename: "ProductVariant",
        id: "dsfsfuhb",
        name: "Hard",
        quantityAvailable: 10,
        preorder: null,
        metadata: [],
        privateMetadata: [],
        product: {
          __typename: "Product",
          id: "UHJvZHVjdDo1",
          isAvailableForPurchase: true,
        },
        stocks: [
          {
            id: "stock_test_id1",
            warehouse: {
              name: "stock_warehouse1",
              id: "V2FyZWhvdXNlOjc4OGUyMGRlLTlmYTAtNDI5My1iZDk2LWUwM2RjY2RhMzc0ZQ==",
              __typename: "Warehouse",
            },
            quantity: 166,
            quantityAllocated: 0,
            __typename: "Stock",
          },
          {
            id: "stock_test_id2",
            warehouse: {
              name: "stock_warehouse2",
              id: "V2FyZWhvdXNlOjczYzI0OGNmLTliNzAtNDlmMi1hMDRlLTM4ZTYxMmQ5MDYwMQ==",
              __typename: "Warehouse",
            },
            quantity: 166,
            quantityAllocated: 0,
            __typename: "Stock",
          },
        ],
      },
    },
    {
      __typename: "OrderLine" as "OrderLine",
      id: "T3JkZXJMaW5lOjQ2",
      isShippingRequired: false,
      productName: "Anderson PLC (15-1337)",
      productSku: "15-1337",
      quantity: 2,
      quantityFulfilled: 0,
      quantityToFulfill: 2,
      isGift: false,
      allocations: [
        {
          id: "allocation_test_id",
          warehouse: {
            name: "US Warehouse",
            id: "V2FyZWhvdXNlOjk1NWY0ZDk2LWRmNTAtNGY0Zi1hOTM4LWM5MTYzYTA4YTViNg==",
            __typename: "Warehouse",
          },
          quantity: 1,
          __typename: "Allocation",
        },
      ],
      thumbnail: {
        __typename: "Image" as "Image",
        url: placeholder,
      },
      totalPrice: {
        __typename: "TaxedMoney",
        gross: {
          __typename: "Money",
          amount: 159.42,
          currency: "USD",
        },
        net: {
          __typename: "Money",
          amount: 159.42,
          currency: "USD",
        },
      },
      undiscountedUnitPrice: {
        __typename: "TaxedMoney",
        currency: "USD",
        gross: {
          __typename: "Money",
          amount: 79.71,
          currency: "USD",
        },
        net: {
          __typename: "Money",
          amount: 79.71,
          currency: "USD",
        },
      },
      unitDiscount: {
        __typename: "Money",
        amount: 79.71,
        currency: "USD",
      },
      unitDiscountReason: null,
      unitDiscountType: null,
      unitDiscountValue: 0,
      unitPrice: {
        __typename: "TaxedMoney" as "TaxedMoney",
        gross: {
          __typename: "Money" as "Money",
          amount: 68.2,
          currency: "USD",
        },
        net: {
          __typename: "Money" as "Money",
          amount: 68.2,
          currency: "USD",
        },
      },
      variant: {
        __typename: "ProductVariant",
        id: "dsfsfuhb",
        name: "15-1337",
        quantityAvailable: 10,
        preorder: null,
        metadata: [],
        privateMetadata: [],
        product: {
          __typename: "Product",
          id: "UHJvZHVjdDo1",
          isAvailableForPurchase: true,
        },
        stocks: [
          {
            id: "stock_test_id1",
            warehouse: {
              name: "stock_warehouse1",
              id: "V2FyZWhvdXNlOjc4OGUyMGRlLTlmYTAtNDI5My1iZDk2LWUwM2RjY2RhMzc0ZQ==",
              __typename: "Warehouse",
            },
            quantity: 166,
            quantityAllocated: 0,
            __typename: "Stock",
          },
          {
            id: "stock_test_id2",
            warehouse: {
              name: "stock_warehouse2",
              id: "V2FyZWhvdXNlOjczYzI0OGNmLTliNzAtNDlmMi1hMDRlLTM4ZTYxMmQ5MDYwMQ==",
              __typename: "Warehouse",
            },
            quantity: 166,
            quantityAllocated: 0,
            __typename: "Stock",
          },
        ],
      },
    },
  ],
  metadata: [],
  number: "24",
  paymentStatus: null,
  privateMetadata: [],
  shippingAddress: null,
  shippingMethod: null,
  shippingMethodName: null,
  collectionPointName: null,
  deliveryMethod: null,
  shippingPrice: {
    __typename: "TaxedMoney" as "TaxedMoney",
    gross: {
      __typename: "Money" as "Money",
      amount: 0,
      currency: "USD",
    },
  },
  status: "DRAFT" as OrderStatus.DRAFT,
  subtotal: {
    __typename: "TaxedMoney" as "TaxedMoney",
    gross: {
      __typename: "Money" as "Money",
      amount: 168.3,
      currency: "USD",
    },
    net: {
      __typename: "Money" as "Money",
      amount: 168.3,
      currency: "USD",
    },
  },
  total: {
    __typename: "TaxedMoney" as "TaxedMoney",
    gross: {
      __typename: "Money" as "Money",
      amount: 168.3,
      currency: "USD",
    },
    net: {
      __typename: "Money" as "Money",
      amount: 100,
      currency: "USD",
    },
    tax: {
      __typename: "Money" as "Money",
      amount: 68.3,
      currency: "USD",
    },
  },
  totalAuthorized: prepareMoney(234.93),
  totalCaptured: prepareMoney(0),
  totalBalance: {
    __typename: "Money" as "Money",
    amount: 168.3,
    currency: "USD",
  },
  undiscountedTotal: {
    __typename: "TaxedMoney",
    gross: {
      __typename: "Money",
      amount: 79.71,
      currency: "USD",
    },
    net: {
      __typename: "Money",
      amount: 79.71,
      currency: "USD",
    },
  },
  user: null,
  userEmail: null,
});

export const draftOrderWithTransactions: OrderDetailsFragment = {
  ...(draftOrder(undefined) as unknown as OrderDetailsFragment),
  payments: [],
  transactions: [],
  grantedRefunds: [],
  totalRemainingGrant: prepareMoney(0),
  totalGrantedRefund: prepareMoney(0),
  totalAuthorizePending: prepareMoney(0),
  totalCharged: prepareMoney(0),
  totalChargePending: prepareMoney(0),
  totalRefunded: prepareMoney(0),
  totalRefundPending: prepareMoney(0),
  totalCanceled: prepareMoney(0),
  totalCancelPending: prepareMoney(0),
};

export const flatOrders = orders.map(order => ({
  ...order,
  orderStatus: transformOrderStatus(order.status, {
    formatMessage: (message: MessageDescriptor) => message.defaultMessage,
  } as any),
  paymentStatus: transformPaymentStatus(order.paymentStatus, {
    formatMessage: (message: MessageDescriptor) => message.defaultMessage,
  } as any),
}));

export const fulfillOrderLine = (
  placeholderImage: string,
): OrderFulfillLineFragment => ({
  __typename: "OrderLine",
  id: "T3JkZXJMaW5lOjIz",
  isShippingRequired: false,
  productName: "Williams, Garcia and Walker (XS)",
  quantity: 2,
  quantityFulfilled: 2,
  quantityToFulfill: 0,
  allocations: [
    {
      id: "allocation_test_id",
      warehouse: {
        name: "US Warehouse",
        id: "V2FyZWhvdXNlOjk1NWY0ZDk2LWRmNTAtNGY0Zi1hOTM4LWM5MTYzYTA4YTViNg==",
        __typename: "Warehouse",
      },
      quantity: 1,
      __typename: "Allocation",
    },
  ],
  thumbnail: {
    __typename: "Image" as "Image",
    url: placeholderImage,
  },
  variant: {
    __typename: "ProductVariant",
    id: "dsfsfuhb",
    name: "Williams, Garcia and Walker (XS)",
    sku: "5-1337",
    attributes: [],
    trackInventory: true,
    preorder: null,
    stocks: [
      {
        id: "stock_test_id1",
        warehouse: {
          name: "stock_warehouse1",
          id: "V2FyZWhvdXNlOjc4OGUyMGRlLTlmYTAtNDI5My1iZDk2LWUwM2RjY2RhMzc0ZQ==",
          __typename: "Warehouse",
        },
        quantity: 166,
        quantityAllocated: 0,
        __typename: "Stock",
      },
      {
        id: "stock_test_id2",
        warehouse: {
          name: "stock_warehouse2",
          id: "V2FyZWhvdXNlOjczYzI0OGNmLTliNzAtNDlmMi1hMDRlLTM4ZTYxMmQ5MDYwMQ==",
          __typename: "Warehouse",
        },
        quantity: 166,
        quantityAllocated: 0,
        __typename: "Stock",
      },
    ],
  },
});

export const variants = [
  { id: "p1", name: "Product 1: variant 1", sku: "12345", stockQuantity: 3 },
  { id: "p2", name: "Product 1: variant 2", sku: "12346", stockQuantity: 1 },
  { id: "p3", name: "Product 2: variant 1", sku: "12355", stockQuantity: 10 },
  { id: "p4", name: "Product 3: variant 1", sku: "12445", stockQuantity: 12 },
  { id: "p5", name: "Product 3: variant 2", sku: "12545", stockQuantity: 7 },
  { id: "p6", name: "Product 5: variant 1", sku: "13345", stockQuantity: 3 },
  { id: "p7", name: "Product 5: variant 2", sku: "14345", stockQuantity: 11 },
];
export const prefixes = ["01", "02", "41", "49"];
export const shippingMethods = [
  { country: "whole world", id: 1, name: "DHL", price: {} },
  { country: "Afghanistan", id: 2, name: "UPS" },
];
export const orderLineSearch = (
  placeholderImage: string,
): RelayToFlat<SearchOrderVariantQuery["search"]> => [
  {
    __typename: "Product" as "Product",
    id: "UHJvZHVjdDo3Mg==",
    name: "Apple Juice",
    thumbnail: {
      __typename: "Image" as "Image",
      url: placeholderImage,
    },
    variants: [
      {
        __typename: "ProductVariant" as "ProductVariant",
        id: "UHJvZHVjdFZhcmlhbnQ6MjAy",
        name: "500ml",
        sku: "93855755",
        pricing: {
          __typename: "VariantPricingInfo",
          onSale: false,
          price: {
            __typename: "TaxedMoney",
            gross: {
              amount: 1,
              currency: "USD",
              __typename: "Money",
            },
          },
          priceUndiscounted: {
            __typename: "TaxedMoney",
            gross: {
              amount: 1,
              currency: "USD",
              __typename: "Money",
            },
          },
        },
      },
      {
        __typename: "ProductVariant" as "ProductVariant",
        id: "UHJvZHVjdFZhcmlhbnQ6MjAz",
        name: "1l",
        sku: "43226647",
        pricing: {
          __typename: "VariantPricingInfo",
          onSale: false,
          price: {
            __typename: "TaxedMoney",
            gross: {
              amount: 1,
              currency: "USD",
              __typename: "Money",
            },
          },
          priceUndiscounted: {
            __typename: "TaxedMoney",
            gross: {
              amount: 1,
              currency: "USD",
              __typename: "Money",
            },
          },
        },
      },
      {
        __typename: "ProductVariant" as "ProductVariant",
        id: "UHJvZHVjdFZhcmlhbnQ6MjA0",
        name: "2l",
        sku: "80884671",
        pricing: {
          __typename: "VariantPricingInfo",
          onSale: false,
          price: {
            __typename: "TaxedMoney",
            gross: {
              amount: 1,
              currency: "USD",
              __typename: "Money",
            },
          },
          priceUndiscounted: {
            __typename: "TaxedMoney",
            gross: {
              amount: 1,
              currency: "USD",
              __typename: "Money",
            },
          },
        },
      },
    ],
  },
  {
    __typename: "Product" as "Product",
    id: "UHJvZHVjdDo3NQ==",
    name: "Pineapple Juice",
    thumbnail: {
      __typename: "Image" as "Image",
      url: placeholderImage,
    },
    variants: [
      {
        __typename: "ProductVariant" as "ProductVariant",
        id: "UHJvZHVjdFZhcmlhbnQ6MjEx",
        name: "500ml",
        sku: "43200242",
        pricing: {
          __typename: "VariantPricingInfo",
          onSale: false,
          price: {
            __typename: "TaxedMoney",
            gross: {
              amount: 1,
              currency: "USD",
              __typename: "Money",
            },
          },
          priceUndiscounted: {
            __typename: "TaxedMoney",
            gross: {
              amount: 1,
              currency: "USD",
              __typename: "Money",
            },
          },
        },
      },
      {
        __typename: "ProductVariant" as "ProductVariant",
        id: "UHJvZHVjdFZhcmlhbnQ6MjEy",
        name: "1l",
        sku: "79129513",
        pricing: {
          __typename: "VariantPricingInfo",
          onSale: false,
          price: {
            __typename: "TaxedMoney",
            gross: {
              amount: 1,
              currency: "USD",
              __typename: "Money",
            },
          },
          priceUndiscounted: {
            __typename: "TaxedMoney",
            gross: {
              amount: 1,
              currency: "USD",
              __typename: "Money",
            },
          },
        },
      },
      {
        __typename: "ProductVariant" as "ProductVariant",
        id: "UHJvZHVjdFZhcmlhbnQ6MjEz",
        name: "2l",
        sku: "75799450",
        pricing: {
          __typename: "VariantPricingInfo",
          onSale: false,
          price: {
            __typename: "TaxedMoney",
            gross: {
              amount: 1,
              currency: "USD",
              __typename: "Money",
            },
          },
          priceUndiscounted: {
            __typename: "TaxedMoney",
            gross: {
              amount: 1,
              currency: "USD",
              __typename: "Money",
            },
          },
        },
      },
    ],
  },
];

export const invoices: InvoiceFragment[] = [
  {
    __typename: "Invoice",
    createdAt: "2020-07-02T12:13:56.901097+00:00",
    id: "SW52b2ljZTo0",
    number: "1/07/2020",
    status: JobStatusEnum.PENDING,
    url: "http://localhost:8000/media/invoices/invoice-1/07/2020-order-20-1fef611b-7514-4dc6-aee3-09a8232b1d6a.pdf",
  },
  {
    __typename: "Invoice",
    createdAt: "2020-07-02T09:06:17.059412+00:00",
    id: "SW52b2ljZToz",
    number: "1/07/2020",
    status: JobStatusEnum.SUCCESS,
    url: "http://localhost:8000/media/invoices/invoice-1/07/2020-order-20-8df26967-ad21-4075-a446-cef44ae05197.pdf",
  },
  {
    __typename: "Invoice",
    createdAt: "2020-07-02T09:05:58.300952+00:00",
    id: "SW52b2ljZToy",
    number: "1/07/2020",
    status: JobStatusEnum.SUCCESS,
    url: "http://localhost:8000/media/invoices/invoice-1/07/2020-order-20-5ebc85e0-e587-4386-8292-9b85839281e6.pdf",
  },
  {
    __typename: "Invoice",
    createdAt: "2020-07-02T09:04:27.257562+00:00",
    id: "SW52b2ljZTox",
    number: "1/07/2020",
    status: JobStatusEnum.SUCCESS,
    url: "http://localhost:8000/media/invoices/invoice-1/07/2020-order-20-0e449e10-ef4b-4066-bebe-361f670b6820.pdf",
  },
];

export const orderSettings: OrderSettingsFragment = {
  __typename: "OrderSettings",
  automaticallyConfirmAllNewOrders: true,
  automaticallyFulfillNonShippableGiftCard: false,
};

export const shopOrderSettings: ShopOrderSettingsFragment = {
  __typename: "Shop",
  fulfillmentAutoApprove: true,
  fulfillmentAllowUnpaid: true,
};

export const warehouseSearch: SearchWarehousesQuery["search"] = {
  totalCount: 20,
  edges: [
    {
      node: {
        id: "V2FyZWhvdXNlOmJiZTEwZjk1LTQyYjAtNDRlMS04Yjc5LWU5MjllMmViYTRjMQ==",
        name: "CyVou-97803",
        __typename: "Warehouse",
      },
      __typename: "WarehouseCountableEdge",
    },
    {
      node: {
        id: "V2FyZWhvdXNlOjdhOGViNThhLTYwN2QtNGMxNC04ODVmLTBiMWU3ZDcyMTIyNQ==",
        name: "CyWarehouse72715",
        __typename: "Warehouse",
      },
      __typename: "WarehouseCountableEdge",
    },
    {
      node: {
        id: "V2FyZWhvdXNlOjY2NWIxZWFmLTU5MDYtNGE0Mi1iYWVkLTc1ODQ3YWNhMWI1NQ==",
        name: "CyWarehouseCheckout70441",
        __typename: "Warehouse",
      },
      __typename: "WarehouseCountableEdge",
    },
    {
      node: {
        id: "V2FyZWhvdXNlOjdkNmVmNmFkLWY4NTMtNGVmNS1iMzQ5LTUyY2I2N2U3NmIwZQ==",
        name: "CyWeightRates-78849",
        __typename: "Warehouse",
      },
      __typename: "WarehouseCountableEdge",
    },
    {
      node: {
        id: "V2FyZWhvdXNlOjcwZjMyYTUyLWVlODQtNGExYi1iMjgzLTgwYjllMzgyNDlkNg==",
        name: "EditShipping-82885",
        __typename: "Warehouse",
      },
      __typename: "WarehouseCountableEdge",
    },
    {
      node: {
        id: "V2FyZWhvdXNlOjczYzI0OGNmLTliNzAtNDlmMi1hMDRlLTM4ZTYxMmQ5MDYwMQ==",
        name: "Europe for click and collect",
        __typename: "Warehouse",
      },
      __typename: "WarehouseCountableEdge",
    },
    {
      node: {
        id: "V2FyZWhvdXNlOjc4OGUyMGRlLTlmYTAtNDI5My1iZDk2LWUwM2RjY2RhMzc0ZQ==",
        name: "Oceania",
        __typename: "Warehouse",
      },
      __typename: "WarehouseCountableEdge",
    },
    {
      node: {
        id: "V2FyZWhvdXNlOjNiZDM0YjEyLTllNDktNDMwZC1iM2QyLTRkYmRhMjM1MGUyOQ==",
        name: "ProductsWithoutSkuInOrder",
        __typename: "Warehouse",
      },
      __typename: "WarehouseCountableEdge",
    },
    {
      node: {
        id: "V2FyZWhvdXNlOmU4M2U2NjQ2LTFhYjctNGNmNC05N2M4LTFiZjI2NGE2NjQ4Yw==",
        name: "StocksThreshold",
        __typename: "Warehouse",
      },
      __typename: "WarehouseCountableEdge",
    },
    {
      node: {
        id: "V2FyZWhvdXNlOmJkMmQ1NDFjLWQwMjMtNDAwNi05YmRjLWZhZTA4OWZlNzZiYg==",
        name: "UpdateProductsSku59844",
        __typename: "Warehouse",
      },
      __typename: "WarehouseCountableEdge",
    },
    {
      node: {
        id: "V2FyZWhvdXNlOjgzNDMwMzI4LTI2YWItNDNkZS1hNzdhLTVmNGNhMTljMDJhNg==",
        name: "WithoutShipmentCheckout-4505",
        __typename: "Warehouse",
      },
      __typename: "WarehouseCountableEdge",
    },
  ],
  pageInfo: {
    endCursor:
      "WyJXaXRob3V0U2hpcG1lbnRDaGVja291dC00NTA1IiwgIldpdGhvdXRTaGlwbWVudENoZWNrb3V0LTQ1MDUiXQ==",
    hasNextPage: false,
    hasPreviousPage: true,
    startCursor: "WyJDeVZvdS05NzgwMyIsICJDeVZvdS05NzgwMyJd",
    __typename: "PageInfo",
  },
  __typename: "WarehouseCountableConnection",
};

export const channelUsabilityData: ChannelUsabilityDataQuery = {
  __typename: "Query",
  products: {
    __typename: "ProductCountableConnection",
    totalCount: 50,
  },
};

export const transactionApp: AppAvatarFragment = {
  name: "Checkout App",
  id: "1234",
  __typename: "App",
};

export const transactionEvent: Omit<TransactionEventFragment, "createdBy"> & {
  createdBy: AppAvatarFragment;
} = {
  id: "VHJhbnNhY3Rpb25FdmVudDox",
  pspReference: "XCFDROVCDF232332DFGS",
  createdAt: "2022-08-12T14:40:22.226875+00:00",
  type: TransactionEventTypeEnum.CHARGE_SUCCESS,
  message: null,
  externalUrl: null,
  createdBy: transactionApp,
  amount: {
    amount: 58.98,
    currency: "USD",
    __typename: "Money",
  },
  __typename: "TransactionEvent",
};

export const transactions: Record<
  | "preauthorized"
  | "pendingCharge"
  | "chargeSuccess"
  | "chargePartial"
  | "chargeFail"
  | "refundRequested"
  | "refundCompleted"
  | "refundPartial",
  TransactionItemFragment[]
> = {
  preauthorized: [
    {
      id: "VHJhbnNhY3Rpb25JdGVtOjE=",
      name: "Mollie",
      pspReference: "ord_3d41ih",
      actions: [TransactionActionEnum.CANCEL, TransactionActionEnum.CHARGE],
      externalUrl: null,
      events: [
        {
          id: "VHJhbnNhY3Rpb25FdmVudDox",
          pspReference: "XCFDSDXCDF232332DFGS",
          createdAt: "2022-08-12T14:10:22.226875+00:00",
          type: TransactionEventTypeEnum.AUTHORIZATION_SUCCESS,
          message: null,
          externalUrl: null,
          createdBy: transactionApp,
          amount: {
            amount: 58.98,
            currency: "USD",
            __typename: "Money",
          },
          __typename: "TransactionEvent",
        },
      ],
      authorizedAmount: prepareMoney(58.98),
      authorizePendingAmount: prepareMoney(0),
      chargedAmount: prepareMoney(0),
      chargePendingAmount: prepareMoney(0),
      refundedAmount: prepareMoney(0),
      refundPendingAmount: prepareMoney(0),
      canceledAmount: prepareMoney(0),
      cancelPendingAmount: prepareMoney(0),
      __typename: "TransactionItem",
    },
  ],
  pendingCharge: [
    {
      id: "VHJhbnNhY3Rpb25JdGVtOjE=",
      name: "Mollie",
      pspReference: "ord_3d41ih",
      externalUrl: null,
      actions: [],
      events: [
        {
          id: "VHJhbnNhY3Rpb25FdmVudDox",
          pspReference: "XCFDROVCDF232332DFGS",
          createdAt: "2022-08-12T14:22:22.226875+00:00",
          type: TransactionEventTypeEnum.CHARGE_REQUEST,
          message: null,
          externalUrl: null,
          createdBy: staffMember,
          amount: {
            amount: 58.98,
            currency: "USD",
            __typename: "Money",
          },
          __typename: "TransactionEvent",
        },
        {
          id: "VHJhbnNhY3Rpb25FdmVudDox",
          pspReference: "XCFDSDXCDF232332DFGS",
          createdAt: "2022-08-12T14:10:22.226875+00:00",
          type: TransactionEventTypeEnum.AUTHORIZATION_SUCCESS,
          message: null,
          externalUrl: null,
          createdBy: transactionApp,
          amount: {
            amount: 58.98,
            currency: "USD",
            __typename: "Money",
          },
          __typename: "TransactionEvent",
        },
      ],
      authorizedAmount: prepareMoney(58.98),
      authorizePendingAmount: prepareMoney(0),
      chargedAmount: prepareMoney(0),
      chargePendingAmount: prepareMoney(58.98),
      refundedAmount: prepareMoney(0),
      refundPendingAmount: prepareMoney(0),
      canceledAmount: prepareMoney(0),
      cancelPendingAmount: prepareMoney(0),
      __typename: "TransactionItem",
    },
  ],
  chargeSuccess: [
    {
      id: "VHJhbnNhY3Rpb25JdGVtOjE=",
      name: "Mollie",
      pspReference: "ord_3d41ih",
      actions: [TransactionActionEnum.REFUND],
      externalUrl: null,
      events: [
        {
          id: "VHJhbnNhY3Rpb25FdmVudDox",
          pspReference: "XCFDROVCDF232332DFGS",
          createdAt: "2022-08-12T14:40:22.226875+00:00",
          type: TransactionEventTypeEnum.CHARGE_SUCCESS,
          message: null,
          externalUrl: null,
          createdBy: transactionApp,
          amount: {
            amount: 58.98,
            currency: "USD",
            __typename: "Money",
          },
          __typename: "TransactionEvent",
        },
        {
          id: "VHJhbnNhY3Rpb25FdmVudDox",
          pspReference: "XCFDROVCDF232332DFGS",
          createdAt: "2022-08-12T14:22:22.226875+00:00",
          type: TransactionEventTypeEnum.CHARGE_REQUEST,
          message: null,
          externalUrl: null,
          createdBy: staffMember,
          amount: {
            amount: 58.98,
            currency: "USD",
            __typename: "Money",
          },
          __typename: "TransactionEvent",
        },
        {
          id: "VHJhbnNhY3Rpb25FdmVudDox",
          pspReference: "XCFDSDXCDF232332DFGS",
          createdAt: "2022-08-12T14:10:22.226875+00:00",
          type: TransactionEventTypeEnum.AUTHORIZATION_SUCCESS,
          message: null,
          externalUrl: null,
          createdBy: transactionApp,
          amount: {
            amount: 58.98,
            currency: "USD",
            __typename: "Money",
          },
          __typename: "TransactionEvent",
        },
      ],
      authorizedAmount: prepareMoney(0),
      authorizePendingAmount: prepareMoney(0),
      chargedAmount: prepareMoney(58.98),
      chargePendingAmount: prepareMoney(0),
      refundedAmount: prepareMoney(0),
      refundPendingAmount: prepareMoney(0),
      canceledAmount: prepareMoney(0),
      cancelPendingAmount: prepareMoney(0),
      __typename: "TransactionItem",
    },
  ],
  chargePartial: [
    {
      id: "VHJhbnNhY3Rpb25JdGVtOjE=",
      name: "Mollie",
      pspReference: "ord_3d41ih",
      actions: [TransactionActionEnum.REFUND],
      externalUrl: null,
      events: [
        {
          id: "VHJhbnNhY3Rpb25FdmVudDox",
          pspReference: "XCFDROVCDF232332DFGS",
          createdAt: "2022-08-12T14:40:22.226875+00:00",
          type: TransactionEventTypeEnum.CHARGE_SUCCESS,
          message: null,
          externalUrl: null,
          createdBy: transactionApp,
          amount: {
            amount: 10,
            currency: "USD",
            __typename: "Money",
          },
          __typename: "TransactionEvent",
        },
        {
          id: "VHJhbnNhY3Rpb25FdmVudDox",
          pspReference: "XCFDROVCDF232332DFGS",
          createdAt: "2022-08-12T14:22:22.226875+00:00",
          type: TransactionEventTypeEnum.CHARGE_REQUEST,
          message: null,
          externalUrl: null,
          createdBy: staffMember,
          amount: {
            amount: 10,
            currency: "USD",
            __typename: "Money",
          },
          __typename: "TransactionEvent",
        },
        {
          id: "VHJhbnNhY3Rpb25FdmVudDox",
          pspReference: "XCFDSDXCDF232332DFGS",
          createdAt: "2022-08-12T14:10:22.226875+00:00",
          type: TransactionEventTypeEnum.AUTHORIZATION_SUCCESS,
          message: null,
          externalUrl: null,
          createdBy: transactionApp,
          amount: {
            amount: 10,
            currency: "USD",
            __typename: "Money",
          },
          __typename: "TransactionEvent",
        },
      ],
      authorizedAmount: prepareMoney(ORDER_AMOUNT - 10),
      authorizePendingAmount: prepareMoney(0),
      chargedAmount: prepareMoney(10),
      chargePendingAmount: prepareMoney(0),
      refundedAmount: prepareMoney(0),
      refundPendingAmount: prepareMoney(0),
      canceledAmount: prepareMoney(0),
      cancelPendingAmount: prepareMoney(0),
      __typename: "TransactionItem",
    },
  ],
  chargeFail: [
    {
      id: "VHJhbnNhY3Rpb25JdGVtOjE=",
      name: "Mollie",
      pspReference: "ord_3d41ih",
      actions: [TransactionActionEnum.CHARGE],
      externalUrl: null,
      events: [
        {
          id: "VHJhbnNhY3Rpb25FdmVudDox",
          pspReference: "XCFDROVCDF232332DFGS",
          createdAt: "2022-08-12T14:40:22.226875+00:00",
          type: TransactionEventTypeEnum.CHARGE_FAILURE,
          message: null,
          externalUrl: null,
          createdBy: transactionApp,
          amount: {
            amount: 10,
            currency: "USD",
            __typename: "Money",
          },
          __typename: "TransactionEvent",
        },
        {
          id: "VHJhbnNhY3Rpb25FdmVudDox",
          pspReference: "XCFDROVCDF232332DFGS",
          createdAt: "2022-08-12T14:22:22.226875+00:00",
          type: TransactionEventTypeEnum.CHARGE_REQUEST,
          message: null,
          externalUrl: null,
          createdBy: staffMember,
          amount: {
            amount: 58.98,
            currency: "USD",
            __typename: "Money",
          },
          __typename: "TransactionEvent",
        },
        {
          id: "VHJhbnNhY3Rpb25FdmVudDox",
          pspReference: "XCFDSDXCDF232332DFGS",
          createdAt: "2022-08-12T14:10:22.226875+00:00",
          type: TransactionEventTypeEnum.AUTHORIZATION_SUCCESS,
          message: null,
          externalUrl: null,
          createdBy: transactionApp,
          amount: {
            amount: 58.98,
            currency: "USD",
            __typename: "Money",
          },
          __typename: "TransactionEvent",
        },
      ],
      authorizedAmount: prepareMoney(58.98),
      authorizePendingAmount: prepareMoney(0),
      chargedAmount: prepareMoney(0),
      chargePendingAmount: prepareMoney(0),
      refundedAmount: prepareMoney(0),
      refundPendingAmount: prepareMoney(0),
      canceledAmount: prepareMoney(0),
      cancelPendingAmount: prepareMoney(0),
      __typename: "TransactionItem",
    },
  ],
  refundRequested: [
    {
      id: "VHJhbnNhY3Rpb25JdGVtOjE=",
      name: "Mollie",
      pspReference: "ord_3d41ih",
      actions: [],
      externalUrl: null,
      events: [
        {
          id: "VHJhbnNhY3Rpb25FdmVudDox",
          pspReference: "FGSDW3E5343DSFGSD",
          createdAt: "2022-08-14T10:40:22.226875+00:00",
          type: TransactionEventTypeEnum.REFUND_REQUEST,
          message: null,
          externalUrl: null,
          createdBy: staffMember,
          amount: {
            amount: 58.98,
            currency: "USD",
            __typename: "Money",
          },
          __typename: "TransactionEvent",
        },
        {
          id: "VHJhbnNhY3Rpb25FdmVudDox",
          pspReference: "XCFDROVCDF232332DFGS",
          createdAt: "2022-08-12T14:40:22.226875+00:00",
          type: TransactionEventTypeEnum.CHARGE_SUCCESS,
          message: null,
          externalUrl: null,
          createdBy: transactionApp,
          amount: {
            amount: 58.98,
            currency: "USD",
            __typename: "Money",
          },
          __typename: "TransactionEvent",
        },
        {
          id: "VHJhbnNhY3Rpb25FdmVudDox",
          pspReference: "XCFDROVCDF232332DFGS",
          createdAt: "2022-08-12T14:22:22.226875+00:00",
          type: TransactionEventTypeEnum.CHARGE_REQUEST,
          message: null,
          externalUrl: null,
          createdBy: transactionApp,
          amount: {
            amount: 58.98,
            currency: "USD",
            __typename: "Money",
          },
          __typename: "TransactionEvent",
        },
        {
          id: "VHJhbnNhY3Rpb25FdmVudDox",
          pspReference: "XCFDSDXCDF232332DFGS",
          createdAt: "2022-08-12T14:10:22.226875+00:00",
          type: TransactionEventTypeEnum.AUTHORIZATION_SUCCESS,
          message: null,
          externalUrl: null,
          createdBy: transactionApp,
          amount: {
            amount: 58.98,
            currency: "USD",
            __typename: "Money",
          },
          __typename: "TransactionEvent",
        },
      ],
      authorizedAmount: prepareMoney(0),
      authorizePendingAmount: prepareMoney(0),
      chargedAmount: prepareMoney(58.98),
      chargePendingAmount: prepareMoney(0),
      refundedAmount: prepareMoney(0),
      refundPendingAmount: prepareMoney(58.98),
      canceledAmount: prepareMoney(0),
      cancelPendingAmount: prepareMoney(0),
      __typename: "TransactionItem",
    },
  ],
  refundCompleted: [
    {
      id: "VHJhbnNhY3Rpb25JdGVtOjE=",
      name: "Mollie",
      pspReference: "ord_3d41ih",
      actions: [],
      externalUrl: null,
      events: [
        {
          id: "VHJhbnNhY3Rpb25FdmVudDox",
          pspReference: "FGSDW3E5343DSFGSD",
          createdAt: "2022-08-14T10:40:22.226875+00:00",
          type: TransactionEventTypeEnum.REFUND_SUCCESS,
          message: null,
          externalUrl: null,
          createdBy: transactionApp,
          amount: {
            amount: 58.98,
            currency: "USD",
            __typename: "Money",
          },
          __typename: "TransactionEvent",
        },
        {
          id: "VHJhbnNhY3Rpb25FdmVudDox",
          pspReference: "FGSDW3E5343DSFGSD",
          createdAt: "2022-08-14T10:40:22.226875+00:00",
          type: TransactionEventTypeEnum.REFUND_REQUEST,
          message: null,
          externalUrl: null,
          createdBy: staffMember,
          amount: {
            amount: 58.98,
            currency: "USD",
            __typename: "Money",
          },
          __typename: "TransactionEvent",
        },
        {
          id: "VHJhbnNhY3Rpb25FdmVudDox",
          pspReference: "XCFDROVCDF232332DFGS",
          createdAt: "2022-08-12T14:40:22.226875+00:00",
          type: TransactionEventTypeEnum.CHARGE_SUCCESS,
          message: null,
          externalUrl: null,
          createdBy: transactionApp,
          amount: {
            amount: 58.98,
            currency: "USD",
            __typename: "Money",
          },
          __typename: "TransactionEvent",
        },
        {
          id: "VHJhbnNhY3Rpb25FdmVudDox",
          pspReference: "XCFDROVCDF232332DFGS",
          createdAt: "2022-08-12T14:22:22.226875+00:00",
          type: TransactionEventTypeEnum.CHARGE_REQUEST,
          message: null,
          externalUrl: null,
          createdBy: transactionApp,
          amount: {
            amount: 58.98,
            currency: "USD",
            __typename: "Money",
          },
          __typename: "TransactionEvent",
        },
        {
          id: "VHJhbnNhY3Rpb25FdmVudDox",
          pspReference: "XCFDSDXCDF232332DFGS",
          createdAt: "2022-08-12T14:10:22.226875+00:00",
          type: TransactionEventTypeEnum.AUTHORIZATION_SUCCESS,
          message: null,
          externalUrl: null,
          createdBy: transactionApp,
          amount: {
            amount: 58.98,
            currency: "USD",
            __typename: "Money",
          },
          __typename: "TransactionEvent",
        },
      ],
      authorizedAmount: prepareMoney(0),
      authorizePendingAmount: prepareMoney(0),
      chargedAmount: prepareMoney(0),
      chargePendingAmount: prepareMoney(0),
      refundedAmount: prepareMoney(58.98),
      refundPendingAmount: prepareMoney(0),
      canceledAmount: prepareMoney(0),
      cancelPendingAmount: prepareMoney(0),
      __typename: "TransactionItem",
    },
  ],
  refundPartial: [
    {
      id: "VHJhbnNhY3Rpb25JdGVtOjE=",
      name: "Mollie",
      pspReference: "ord_3d41ih",
      actions: [],
      externalUrl: null,
      events: [
        {
          id: "VHJhbnNhY3Rpb25FdmVudDox",
          pspReference: "FGSDW3E5343DSFGSD",
          createdAt: "2022-08-14T10:40:22.226875+00:00",
          type: TransactionEventTypeEnum.REFUND_SUCCESS,
          message: null,
          externalUrl: null,
          createdBy: transactionApp,
          amount: {
            amount: 10,
            currency: "USD",
            __typename: "Money",
          },
          __typename: "TransactionEvent",
        },
        {
          id: "VHJhbnNhY3Rpb25FdmVudDox",
          pspReference: "FGSDW3E5343DSFGSD",
          createdAt: "2022-08-14T10:40:22.226875+00:00",
          type: TransactionEventTypeEnum.REFUND_REQUEST,
          message: null,
          externalUrl: null,
          createdBy: staffMember,
          amount: {
            amount: 10,
            currency: "USD",
            __typename: "Money",
          },
          __typename: "TransactionEvent",
        },
        {
          id: "VHJhbnNhY3Rpb25FdmVudDox",
          pspReference: "XCFDROVCDF232332DFGS",
          createdAt: "2022-08-12T14:40:22.226875+00:00",
          type: TransactionEventTypeEnum.CHARGE_SUCCESS,
          message: null,
          externalUrl: null,
          createdBy: transactionApp,
          amount: {
            amount: 58.98,
            currency: "USD",
            __typename: "Money",
          },
          __typename: "TransactionEvent",
        },
        {
          id: "VHJhbnNhY3Rpb25FdmVudDox",
          pspReference: "XCFDROVCDF232332DFGS",
          createdAt: "2022-08-12T14:22:22.226875+00:00",
          type: TransactionEventTypeEnum.CHARGE_REQUEST,
          message: null,
          externalUrl: null,
          createdBy: staffMember,
          amount: {
            amount: 58.98,
            currency: "USD",
            __typename: "Money",
          },
          __typename: "TransactionEvent",
        },
        {
          id: "VHJhbnNhY3Rpb25FdmVudDox",
          pspReference: "XCFDSDXCDF232332DFGS",
          createdAt: "2022-08-12T14:10:22.226875+00:00",
          type: TransactionEventTypeEnum.AUTHORIZATION_SUCCESS,
          message: null,
          externalUrl: null,
          createdBy: transactionApp,
          amount: {
            amount: 58.98,
            currency: "USD",
            __typename: "Money",
          },
          __typename: "TransactionEvent",
        },
      ],
      authorizedAmount: prepareMoney(0),
      authorizePendingAmount: prepareMoney(0),
      chargedAmount: prepareMoney(ORDER_AMOUNT - 10),
      chargePendingAmount: prepareMoney(0),
      refundedAmount: prepareMoney(10),
      refundPendingAmount: prepareMoney(0),
      canceledAmount: prepareMoney(0),
      cancelPendingAmount: prepareMoney(0),
      __typename: "TransactionItem",
    },
  ],
};

const paymentCommon = {
  gateway: MOCK_PAYMENT_GATEWAY_ID,
  id: "sdfgdfwe4sdSDFDS==",
  isActive: true,
  availableRefundAmount: prepareMoney(0),
  __typename: "Payment",
} as const;

export const payments: Record<string, OrderPaymentFragment> = {
  pending: {
    ...paymentCommon,
    actions: [OrderAction.VOID],
    paymentMethodType: "card",
    total: prepareMoney(),
    availableCaptureAmount: prepareMoney(),
    capturedAmount: prepareMoney(0),
    modified: "2022-08-22T10:40:22.226875+00:00",
    transactions: [
      {
        created: "2022-08-22T10:40:22.226875+00:00",
        id: "VHJhbnNhY3Rpb246NTQ=",
        isSuccess: true,
        kind: TransactionKind.PENDING,
        token: "4000000000001112",
        __typename: "Transaction",
      },
    ],
  },
  authorized: {
    ...paymentCommon,
    actions: [OrderAction.CAPTURE],
    paymentMethodType: "",
    total: prepareMoney(),
    capturedAmount: prepareMoney(0),
    availableCaptureAmount: prepareMoney(),
    transactions: [
      {
        created: "2022-08-22T10:40:22.226875+00:00",
        id: "VHJhbnNhY3Rpb246NTQ=",
        isSuccess: true,
        kind: TransactionKind.AUTH,
        token: "pending",
        __typename: "Transaction",
      },
    ],
    modified: "2022-08-22T10:40:22.226875+00:00",
  },
  completed: {
    ...paymentCommon,
    actions: [OrderAction.REFUND],
    paymentMethodType: "card",
    total: prepareMoney(),
    availableCaptureAmount: null,
    capturedAmount: prepareMoney(),
    modified: "2022-08-22T10:40:22.226875+00:00",
    transactions: [
      {
        created: "2022-08-22T10:40:22.226875+00:00",
        id: "VHJhbnNhY3Rpb246NTQ=",
        isSuccess: true,
        kind: TransactionKind.CAPTURE,
        token: "4000000000001112",
        __typename: "Transaction",
      },
    ],
  },
  refunded: {
    ...paymentCommon,
    actions: [],
    paymentMethodType: "card",
    total: prepareMoney(),
    availableCaptureAmount: null,
    capturedAmount: prepareMoney(0), // refund = full
    modified: "2022-08-22T10:40:22.226875+00:00",
    transactions: [
      {
        created: "2022-08-22T10:40:22.226875+00:00",
        id: "VHJhbnNhY3Rpb246NTQ=",
        isSuccess: true,
        kind: TransactionKind.CAPTURE,
        token: "4000000000001112",
        __typename: "Transaction",
      },
      {
        created: "2022-09-22T13:39:54.955111+00:00",
        id: "VHJhbnNhY3Rpb246NTU=",
        isSuccess: true,
        kind: TransactionKind.REFUND,
        token: "4000000000001112",
        __typename: "Transaction",
      },
    ],
  },
  partialRefund: {
    ...paymentCommon,
    actions: [OrderAction.REFUND],
    paymentMethodType: "card",
    total: prepareMoney(),
    availableCaptureAmount: null,
    capturedAmount: prepareMoney(ORDER_AMOUNT - 1), // refunded = 1 USD
    modified: "2022-08-22T10:40:22.226875+00:00",
    transactions: [
      {
        created: "2022-08-22T10:40:22.226875+00:00",
        id: "VHJhbnNhY3Rpb246NTQ=",
        isSuccess: true,
        kind: TransactionKind.CAPTURE,
        token: "4000000000001112",
        __typename: "Transaction",
      },
      {
        created: "2022-09-22T13:39:54.955111+00:00",
        id: "VHJhbnNhY3Rpb246NTU=",
        isSuccess: true,
        kind: TransactionKind.REFUND,
        token: "4000000000001112",
        __typename: "Transaction",
      },
    ],
  },
  rejected: {
    ...paymentCommon,
    actions: [OrderAction.CAPTURE, OrderAction.VOID],
    paymentMethodType: "card",
    total: prepareMoney(),
    availableCaptureAmount: prepareMoney(),
    capturedAmount: prepareMoney(0),
    modified: "2022-08-22T10:40:22.226875+00:00",
    transactions: [
      {
        created: "2022-08-22T10:40:22.226875+00:00",
        id: "VHJhbnNhY3Rpb246NTQ=",
        isSuccess: true,
        kind: TransactionKind.AUTH,
        token: "4000000000001112",
        __typename: "Transaction",
      },
    ],
  },
};

export const grantedRefunds: OrderGrantedRefundFragment[] = [
  {
    id: "1234",
    shippingCostsIncluded: true,
    amount: prepareMoney(),
    reason: "Products returned",
    app: { id: "123", name: "Saleor Checkout", __typename: "App" },
    user: null,
    createdAt: "2022-08-22T10:40:22.226875+00:00",
    __typename: "OrderGrantedRefund",
  },
  {
    id: "12344",
    shippingCostsIncluded: false,
    amount: prepareMoney(),
    reason: "Products arrived damaged",
    app: null,
    user: {
      id: "123",
      email: "john.doe@example.com",
      avatar: null,
      lastName: "John",
      firstName: "Doe",
      __typename: "User",
    },
    createdAt: "2022-08-22T10:40:22.226875+00:00",
    __typename: "OrderGrantedRefund",
  },
];
